﻿using DocumentFormat.OpenXml.Lite.Helper;
using DocumentFormat.OpenXml.Lite.WordprocessingML.Word.Types;
using DocumentFormat.OpenXml.Lite.Xml;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace DocumentFormat.OpenXml.Lite.WordprocessingML.Word.RunProperties
{
    [XmlRoot("eastAsianLayout", Namespace = Constants.WordMain)]
    public class EastAsianLayout : XmlSerializable, IRunPropElement
    {
        [Optional]
        [XmlAttribute("id", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public int Id { get; set; }

        [Optional]
        [XmlAttribute("combine", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public Nullable<ST_OnOff> TwoLinesInOne { get; set; }

        /// <summary>
        /// Display Brackets Around Two Lines in One
        /// </summary>
        [Optional]
        [XmlAttribute("combineBrackets", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public Nullable<ST_CombineBrackets> CombineBrackets { get; set; }

        [Optional]
        [XmlAttribute("vert", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public Nullable<ST_OnOff> HorizontalInVertical { get; set; }

        [Optional]
        [XmlAttribute("vertCompress", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public Nullable<ST_OnOff> CompressRotatedTextToLineHeight { get; set; }

        public EastAsianLayout() { }

        public void Copy(object obj)
        {
            if (obj is EastAsianLayout)
            {
                this.Id = (obj as EastAsianLayout).Id;
                this.TwoLinesInOne = (obj as EastAsianLayout).TwoLinesInOne;
                this.CombineBrackets = (obj as EastAsianLayout).CombineBrackets;
                this.HorizontalInVertical = (obj as EastAsianLayout).HorizontalInVertical;
                this.CompressRotatedTextToLineHeight = (obj as EastAsianLayout).CompressRotatedTextToLineHeight;
            }
        }
    }
}
